package com.lh.java.socket;

import java.net.*;
import java.io.*;

public class ServerPrimary {
	private ServerSocket ss;
	private Socket socket;
	private BufferedReader in;
	private PrintWriter out;

	public ServerPrimary() {
		try {
			System.out.println("server listen");
			ss = new ServerSocket(10000);		
			while (true) {
				socket = ss.accept();
				System.out.println("a clint get in");
				in = new BufferedReader(new InputStreamReader(
						socket.getInputStream()));
				out = new PrintWriter(socket.getOutputStream(), true);
				String line = in.readLine();
				out.println("you input is :" + line);
				out.close();
				in.close();
				socket.close();
			}
			// ss.close();
		} catch (IOException e) {
		}
	}

	public static void main(String[] args) {
		new ServerPrimary();
	}
}